package com.ruoyi.customerService.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.customerService.domain.CsSignRateUnStandardExamine;
import com.ruoyi.customerService.domain.vo.CsSignRateUnStandardExamineVo;
import com.ruoyi.customerService.mapper.CsSignRateUnStandardExamineMapper;
import com.ruoyi.customerService.service.CsSignRateUnStandardExamineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class CsSignRateUnStandardExamineServiceImpl implements CsSignRateUnStandardExamineService {
    @Autowired
    private CsSignRateUnStandardExamineMapper csSignRateUnStandardExamineMapper;
    @Override
    public List<CsSignRateUnStandardExamine> collect(CsSignRateUnStandardExamineVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<CsSignRateUnStandardExamine> examines = csSignRateUnStandardExamineMapper.collect(vo);
        assert examines != null;
        for (CsSignRateUnStandardExamine examine : examines){
            examine.setD1Penalty(new BigDecimal(5));
            examine.setD2Penalty(new BigDecimal(5));
            examine.setD3Penalty(new BigDecimal(5));
            examine.setD1SignRateGoal("0.993");
            examine.setD2SignRateGoal("0.995");
            examine.setD3SignRateGoal("0.999");
            if (vo.getTimeType() == 1){
                examine.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
        }
        return examines;
    }
}
